HEX
Server: LiteSpeed
System: Linux eticaretsrv4.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: sioberen (1086)
PHP: 7.3.33
Disabled: NONE
Upload Files
File: /home/sioberen/public_html/cache/sitemap.php
<?php
header('Content-Type: application/xml; charset=utf-8');

require_once __DIR__ . '/config.php';

try {
    $data = getSitemapData();
    if (!$data || !isset($data['urls'])) {
        throw new Exception("Invalid API response format");
    }
    
    $urls = $data['urls'];
    $domain = $host;
    
    $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    $xml .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
    
    foreach ($urls as $url_data) {
        $product_id = $url_data['id'];
        $crawled_at = $url_data['crawled_at'];
        $product_title = isset($url_data['title']) ? $url_data['title'] : null;
        
        $loc = buildProductUrl($product_id, $product_title);
        $lastmod = date('Y-m-d', strtotime($crawled_at));
        
        $xml .= "  <url>\n";
        $xml .= "    <loc>" . htmlspecialchars($loc) . "</loc>\n";
        $xml .= "    <lastmod>" . htmlspecialchars($lastmod) . "</lastmod>\n";
        $xml .= "    <changefreq>daily</changefreq>\n";
        $xml .= "  </url>\n";
    }
    
    $xml .= "</urlset>";
    
    echo $xml;
    
} catch (Exception $e) {
    error_log("Sitemap generation error: " . $e->getMessage());
    
    $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    $xml .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
    $xml .= "</urlset>";
    
    echo $xml;
}